package com.atues.five;

public class Main {
    public static void main(String[] args) {
        String a = new String("ab"); // a 为一个引用
        String b = new String("ab"); // b为另一个引用,对象的内容一样
        String aa = "ab"; // 放在常量池中
        String bb = "ab"; // 从常量池中查找
        System.out.println(aa == bb);// true
        System.out.println(a == b);// false
        System.out.println(a.equals(b));// true
        System.out.println(42 == 42.0);// true

        System.out.println(42 == 42.0); // true，int 提升为 double
        System.out.println(42L == 42.0); // true，long 提升为 double
        System.out.println(42.0f == 42.0); // true，float 提升为 double
        System.out.println(42 == 42.1); // false，42.0 != 42.1

        String s = "a";

        s = s + "b";
        System.out.println(s == s + "b");
    }
}
